package com.info33.platform.system.controller;

import com.info33.platform.common.exception.BaseException;
import com.info33.platform.common.mvc.controller.BaseController;
import com.info33.platform.common.mvc.vo.Result;
import com.info33.platform.system.dto.SysUserDTO;
import com.info33.platform.system.entity.SysLog;
import com.info33.platform.system.service.SysLogService;
import com.info33.platform.system.service.SysLoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @author admin
 */
@RestController
@RequestMapping("/SysLog")
@Api(tags = "系统 - 日志")
public class SysLogController extends BaseController<SysLogService, SysLog> {

    private final SysLogService sysLogService;

    @Autowired
    public SysLogController(SysLogService sysLogService) {
        super(sysLogService);
        this.sysLogService = sysLogService;
    }

    @DeleteMapping(value = "/clear")
    @ApiOperation(value = "pc - 清空")
    public Result<Object> pcClear() {
        return sysLogService.pcClear(getCurrentUser());
    }

    @GetMapping("/loginSessionList")
    @ApiOperation(value = "pc - 获取shior内记录的登录用户session")
    public Result<?> loginSessionList() throws BaseException {
        return sysLogService.loginSessionList();
    }

}